<%--
  Created by IntelliJ IDEA.
  User: 14190
  Date: 2022/11/7
  Time: 11:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
</head>
<body>

用户名:${username}<br />
密码:${password}<br />

登录:${login}<br />

学生信息:${stu.name},${stu.id},${stu.age}<br />

<h1>1. 判断标签 c:if</h1>
<c:if test="${login==true}">用户已登录</c:if>
<c:if test="${login!=true}">用户未登录</c:if>

<h1>2. 判断标签 c:choose</h1>

<c:choose>
    <c:when test="${city=='wuxi'}">
        无锡
    </c:when>
    <c:when test="${city=='suzhou'}">
        苏州
    </c:when>
    <c:when test="${city=='shanghai'}">
        上海
    </c:when>
    <c:otherwise>
        其他城市
    </c:otherwise>
</c:choose>

<h1>3. 循环标签 c:forEach</h1>
<c:forEach var="i" begin="1" end="10" step="1">
    ${i}<br />
</c:forEach>
<hr />

<!--
	for(Student s:stus)
	{
	}


	var 迭代容器中的对象
	items 要迭代的容器
	varStatus 迭代的状态
		index 下标   0
		count 第几个  1
		first 是否是第一个
		last  是否是最后一个
		current  迭代到的对象


 -->
<table border="1">
    <thead>
    <tr>
        <th>序号</th><th>学号</th><th>姓名</th><th>年龄</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach var="s" items="${stus}" varStatus="status">
        <tr>
            <td>${status.index+1}</td>
            <td>${s.id}</td>
            <td>${s.name}</td>
            <td>${s.age}</td>
        </tr>
    </c:forEach>
    </tbody>
</table>


</body>
</html>